/**
 * 
 */
package com.leo.jdkcore.kafka;

import java.util.Properties;

import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

/**
 * Description:
 * 
 * @author lianliang
 * @date 2017年12月9日 下午2:34:09
 */
public class KafkaReaderContext {

	private ThreadPoolTaskExecutor executor;
	private Properties prop;
	private String topic;
	private Integer numPartitions;
	private String username;
	private String password;
	private String host;
	private Integer port;
	private String path;
	private String type;
	private String areaCode;

	/**
	 * 
	 */
	public KafkaReaderContext(Builder builder) {
		this.executor = builder.executor;
		this.prop = builder.prop;
		this.topic = builder.topic;
		this.numPartitions = builder.numPartitions;
		this.username = builder.username;
		this.password = builder.password;
		this.host = builder.host;
		this.port = builder.port;
		this.path = builder.path;
		this.type = builder.type;
		this.areaCode = builder.areaCode;
	}

	/**
	 * @return the executor
	 */
	public ThreadPoolTaskExecutor getExecutor() {
		return executor;
	}

	/**
	 * @param executor
	 *            the executor to set
	 */
	public void setExecutor(ThreadPoolTaskExecutor executor) {
		this.executor = executor;
	}

	/**
	 * @return the prop
	 */
	public Properties getProp() {
		return prop;
	}

	/**
	 * @param prop
	 *            the prop to set
	 */
	public void setProp(Properties prop) {
		this.prop = prop;
	}

	/**
	 * @return the topic
	 */
	public String getTopic() {
		return topic;
	}

	/**
	 * @param topic
	 *            the topic to set
	 */
	public void setTopic(String topic) {
		this.topic = topic;
	}

	/**
	 * @return the numPartitions
	 */
	public Integer getNumPartitions() {
		return numPartitions;
	}

	/**
	 * @param numPartitions
	 *            the numPartitions to set
	 */
	public void setNumPartitions(Integer numPartitions) {
		this.numPartitions = numPartitions;
	}

	/**
	 * @return the username
	 */
	public String getUsername() {
		return username;
	}

	/**
	 * @param username
	 *            the username to set
	 */
	public void setUsername(String username) {
		this.username = username;
	}

	/**
	 * @return the password
	 */
	public String getPassword() {
		return password;
	}

	/**
	 * @param password
	 *            the password to set
	 */
	public void setPassword(String password) {
		this.password = password;
	}

	/**
	 * @return the host
	 */
	public String getHost() {
		return host;
	}

	/**
	 * @param host
	 *            the host to set
	 */
	public void setHost(String host) {
		this.host = host;
	}

	/**
	 * @return the port
	 */
	public Integer getPort() {
		return port;
	}

	/**
	 * @param port
	 *            the port to set
	 */
	public void setPort(Integer port) {
		this.port = port;
	}

	/**
	 * @return the path
	 */
	public String getPath() {
		return path;
	}

	/**
	 * @param path
	 *            the path to set
	 */
	public void setPath(String path) {
		this.path = path;
	}

	/**
	 * @return the type
	 */
	public String getType() {
		return type;
	}

	/**
	 * @param type
	 *            the type to set
	 */
	public void setType(String type) {
		this.type = type;
	}

	/**
	 * @return the areaCode
	 */
	public String getAreaCode() {
		return areaCode;
	}

	/**
	 * @param areaCode
	 *            the areaCode to set
	 */
	public void setAreaCode(String areaCode) {
		this.areaCode = areaCode;
	}

	/**
	 * Description:
	 * 
	 * @author lianliang
	 * @date 2017年12月9日 下午2:52:28
	 */
	public static class Builder {
		private ThreadPoolTaskExecutor executor;
		private Properties prop;
		private String topic;
		private Integer numPartitions;
		private String username;
		private String password;
		private String host;
		private Integer port;
		private String path;
		private String type;
		private String areaCode;

		/**
		 * @param executor
		 *            the executor to set
		 */
		public Builder setExecutor(ThreadPoolTaskExecutor executor) {
			this.executor = executor;
			return this;
		}

		/**
		 * @param prop
		 *            the prop to set
		 */
		public Builder setProp(Properties prop) {
			this.prop = prop;
			return this;
		}

		/**
		 * @param topic
		 *            the topic to set
		 */
		public Builder setTopic(String topic) {
			this.topic = topic;
			return this;
		}

		/**
		 * @param numPartitions
		 *            the numPartitions to set
		 */
		public Builder setNumPartitions(Integer numPartitions) {
			this.numPartitions = numPartitions;
			return this;
		}

		/**
		 * @param username
		 *            the username to set
		 */
		public Builder setUsername(String username) {
			this.username = username;
			return this;
		}

		/**
		 * @param password
		 *            the password to set
		 */
		public Builder setPassword(String password) {
			this.password = password;
			return this;
		}

		/**
		 * @param host
		 *            the host to set
		 */
		public Builder setHost(String host) {
			this.host = host;
			return this;
		}

		/**
		 * @param port
		 *            the port to set
		 */
		public Builder setPort(Integer port) {
			this.port = port;
			return this;
		}

		/**
		 * @param path
		 *            the path to set
		 */
		public Builder setPath(String path) {
			this.path = path;
			return this;
		}

		/**
		 * @param type
		 *            the type to set
		 */
		public Builder setType(String type) {
			this.type = type;
			return this;
		}

		/**
		 * @param areaCode
		 *            the areaCode to set
		 */
		public Builder setAreaCode(String areaCode) {
			this.areaCode = areaCode;
			return this;
		}

		public KafkaReaderContext build() {
			return new KafkaReaderContext(this);
		}

	}
}
